from time import strftime, localtime


def fn(monthage):

    # 当前日期
    date = strftime('%Y-%m-%d', localtime())
    d = date.split('-')
    d1 = int(d[0])
    d2 = int(d[1])
    d3 = int(d[2])

    # 出生年月日
    m = str(monthage).split('-')
    m1 = int(m[0])
    m2 = int(m[1])
    m3 = int(m[2])

    age = d1 - m1  # 年龄
    if d2 > m2:
        month = d2 - m2  # 月
        totalmonth = age * 12 + month  # 月龄
        return (age, month, totalmonth)

    elif d2 == m2:
        if d3 > m3 or d3 == m3:
            month = 0
            totalmonth = age * 12 + month
            return (age, month, totalmonth)
        else:
            age = age - 1
            month = d2 + 11 - m2
            totalmonth = age * 12 + month
            return (age, month, totalmonth)
    else:
        if d3 > m3 or d3 == m3:
            age = age - 1
            month = d2 + 12 - m2
            totalmonth = age * 12 + month
            return (age, month, totalmonth)

        else:
            age = age - 1
            month = d2 + 11 - m2
            totalmonth = age * 12 + month
            return (age, month, totalmonth)


# 计算年龄+月龄
def fx(age):
    moon_age = age % 12  # 判断是否有余数
    if moon_age:
        uage = age // 12
        return (uage, moon_age)  # (年龄，月龄)
    else:
        uage = age // 12
        return uage

